%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/functions/computed-column-setof-message"
    Bucket0("Bucket 0 (root)<br /><br />1: PgSelectInlineApply[25]<br />ᐳ: 8, 9, 24, 29, 10<br />2: PgSelect[7]<br />ᐳ: Access[26]<br />3: PgSelectRows[12]<br />ᐳ: 11, 13, 27, 28"):::bucket
    Bucket1("Bucket 1 (nullableBoundary)<br />Deps: 28, 13<br /><br />ROOT PgSelectSingleᐸforumsᐳ[13]"):::bucket
    Bucket2("Bucket 2 (listItem)<br /><br />ROOT __Item{2}ᐸ20ᐳ[21]"):::bucket
    Bucket3("Bucket 3 (nullableBoundary)<br />Deps: 22<br /><br />ROOT PgSelectSingle{2}ᐸforums_featured_messagesᐳ[22]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3

    %% plan dependencies
    PgSelect7[["PgSelect[7∈0] ➊<br />ᐸforumsᐳ<br />More deps:<br />- Constantᐸ'f1700000-0000-0000-0000-000000000f17'ᐳ[29]"]]:::plan
    Object10{{"Object[10∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    PgFromExpression24{{"PgFromExpression[24∈0] ➊"}}:::plan
    PgSelectInlineApply25["PgSelectInlineApply[25∈0] ➊"]:::plan
    Object10 & PgFromExpression24 & PgSelectInlineApply25 --> PgSelect7
    Access8{{"Access[8∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access8 & Access9 --> Object10
    List27{{"List[27∈0] ➊<br />ᐸ26,11ᐳ"}}:::plan
    Access26{{"Access[26∈0] ➊<br />ᐸ7.m.subqueryDetailsFor15ᐳ"}}:::plan
    First11{{"First[11∈0] ➊"}}:::plan
    Access26 & First11 --> List27
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access8
    __Value2 --> Access9
    PgSelectRows12[["PgSelectRows[12∈0] ➊"]]:::plan
    PgSelectRows12 --> First11
    PgSelect7 --> PgSelectRows12
    PgSelect7 --> Access26
    Lambda28{{"Lambda[28∈0] ➊<br />ᐸpgInlineViaSubqueryTransformᐳ"}}:::plan
    List27 --> Lambda28
    PgSelectRows20[["PgSelectRows[20∈1] ➊"]]:::plan
    Lambda28 --> PgSelectRows20
    __Item21[/"__Item[21∈2]<br />ᐸ20ᐳ"\]:::itemplan
    PgSelectRows20 ==> __Item21
    PgSelectSingle22{{"PgSelectSingle[22∈2]<br />ᐸforums_featured_messagesᐳ"}}:::plan
    __Item21 --> PgSelectSingle22
    PgClassExpression23{{"PgClassExpression[23∈3]<br />ᐸ__forums_f...s__.”body”ᐳ"}}:::plan
    PgSelectSingle22 --> PgClassExpression23

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect7,Access8,Access9,Object10,First11,PgSelectRows12,PgFromExpression24,PgSelectInlineApply25,Access26,List27,Lambda28 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,PgSelectRows20 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,__Item21,PgSelectSingle22 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,PgClassExpression23 bucket3

